package cc.jcizp.userservice.enums;

public enum ExecutionStateEnum {
    SUCCESS(1,"操作成功"),
    FAIL(-1,"注册失败"),
    NAME_EXIST(-2,"用户标识已存在"),
    AUTHENTICATION_FAIL(-3,"用户验证失败"),
    INFO_NOT_COMPLITE(-4,"表单信息不完整");

    private int state;

    private String info;

    ExecutionStateEnum(int state, String info) {
        this.state = state;
        this.info = info;
    }

    public int getState() {
        return state;
    }

    public String getInfo() {
        return info;
    }

    public static ExecutionStateEnum stateOf(int index){
        for(ExecutionStateEnum executionStateEnum : values()){
            if(executionStateEnum.getState() == index){
                return executionStateEnum;
            }
        }
        return null;
    }
}
